New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cmr1-cli

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmr1-cli

Generic CLI helper

  • 0.1.16
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm version build status

cli-node

NodeJS CLI module

Example: (from scratch.js)

const Cmr1Cli = require('cmr1-cli');

const additionalOptions = [
  { 
    name: 'src', 
    alias: 's', 
    type: String, 
    multiple: true, 
    defaultOption: true, 
    description: 'Input source', 
    typeLabel: '[underline]{file}' 
  },
  { 
    name: 'timeout', 
    alias: 't', 
    type: Number, 
    description: 'Timeout', 
    typeLabel: '[underline]{ms}' 
  }
];

const myCli = new Cmr1Cli({
  name: 'My CLI script name',
  description: 'A description of this script',
  helpHeader: 'Available Options',
  optionDefinitions: additionalOptions,
  logging: {
    test: {
      verbose: true,  // Consider this debug, only show when verbose
      throws: false,  // Should this log type throw an Error?
      stamp: true,    // Also prefix log output with a timestamp
      prefix: 'Test', // Prefix string to show before each log msg
      color: 'blue'   // Color of output text (FG only)
    }
  }
});

Object.keys(myCli.settings.logging).forEach(type => {
  myCli[type](`This is a(n) ${type} message!`);
  myCli[type](`Called using: myCli.${type}('message')`)
});

additionalOptions.forEach(option => {
  const name = option.name;
  const value = myCli.options[name];

  myCli.log(`Option '${name}' = '${value}'`);
});


Example console output:

Command: node scratch.js --src /path/to/input/file --timeout 1000 -fv

Example console output

Example help menu:

Command: node scratch.js --help

Example help menu

FAQs

Package last updated on 24 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc